#
# python2
# pip install pymysql
#
import pymysql

conn = pymysql.connect(host='192.168.18.147', user='testdbuser',
                       passwd='testdbuser', charset='utf8', port=3306)

cur = conn.cursor()

cur.execute('show databases')

databases = []
for i in cur:
    databases.append(i)

cur.close()
conn.close()

print (databases)
